<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="ford-arg/tags" prefix="ft" %>

<h1>Pagina de Administraci&oacute;n</h1>
<br>
<br>
<html:form action="AdminDownloadLogs">
	<html:submit value="Descargar Logs" styleClass="button"/>
</html:form>
<br>

<html:form action="ChangeLogLevel" styleId="AdminLogsFormId">
<ft:setToken/>
<table style="text-align:left;">
    <tr>
        <td><bean:message key="label.package"/>:</td>
        <td>
			<html:select property="packSelected" onchange="javasript:loadClasses()">
                <html:option value=""><bean:message key="label.selectOption"/></html:option>
    			<logic:present name="AdminLogsForm" property="javaPackages">
					<html:options name="AdminLogsForm" property="javaPackages"/>
    			</logic:present>
			</html:select>			
        </td>
        <td/>
    </tr>
    <tr>
        <td><bean:message key="label.clase"/>:</td>
        <td>
			<logic:present name="AdminLogsForm" property="javaClasses">
                <logic:notEmpty name="AdminLogsForm" property="javaClasses">
                    <html:select property="classSelected">
                        <html:option value=""><bean:message key="label.selectOption"/></html:option>
                        <html:options name="AdminLogsForm" property="javaClasses"/>
                    </html:select>
                </logic:notEmpty>
                <logic:empty name="AdminLogsForm" property="javaClasses">
                    <i>El package seleccionado no tiene clases</i>
                </logic:empty>
			</logic:present>
			<logic:notPresent name="AdminLogsForm" property="javaClasses">
                <html:select property="classSelected" disabled="true">
                    <html:option value=""><bean:message key="label.selectOption"/></html:option>
                </html:select>
			</logic:notPresent>
        </td>
        <td>
			<logic:notEmpty name="AdminLogsForm" property="javaClasses">
                <html:submit value="Cambiar" styleClass="button"/>
            </logic:notEmpty>
			<logic:empty name="AdminLogsForm" property="javaClasses">
                <html:submit value="Cambiar" disabled="true" styleClass="button"/>
            </logic:empty>
        </td>
    </tr>
    <tr>
        <td><bean:message key="label.nivel"/>:</td>
        <td>
            <html:select property="level" value="INFO">
                <html:option value="ALL">ALL</html:option>
                <html:option value="DEBUG">DEBUG</html:option>
                <html:option value="INFO">INFO</html:option>
                <html:option value="ERROR">ERROR</html:option>
                <html:option value="OFF">OFF</html:option>
            </html:select>
        </td>
        <td/>
    </tr>
</table>
</html:form>	
	

<script language="javascript">
	function loadClasses() {
		document.forms.AdminLogsFormId.action = 'AdminGetClassesFromPackage.do';
		document.forms.AdminLogsFormId.submit();
	}
</script>
